| Conditions | 1 |
| Total Lines | 66 |
| Code Lines | 41 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | // jshint esversion: 8 |
||
| 7 | (async function loadHtml() { |
||
| 8 | var htmlpath = "./"; |
||
| 9 | var path = { |
||
| 10 | nav: htmlpath + "navigation/", |
||
| 11 | tab: htmlpath + "tabs/", |
||
| 12 | }; |
||
| 13 | var additionalPaths = { |
||
| 14 | bw: htmlpath + path.tab + "bw/", |
||
| 15 | bwa: htmlpath + path.tab + "bwa/", |
||
| 16 | bwm: htmlpath + path.tab + "bwm/", |
||
| 17 | to: htmlpath + path.tab + "to/", |
||
| 18 | op: htmlpath + path.tab + "op/" |
||
| 19 | }; |
||
| 20 | |||
| 21 | Object.assign(path, additionalPaths); |
||
| 22 | |||
| 23 | var { |
||
| 24 | bw, |
||
| 25 | bwa, |
||
| 26 | bwm, |
||
| 27 | to, |
||
| 28 | op, |
||
| 29 | nav, |
||
| 30 | tab |
||
| 31 | } = path; |
||
| 32 | |||
| 33 | // Navigation bar |
||
| 34 | $('#navTop').load(nav + "navTop.html"); |
||
| 35 | $('#navBottom').load(nav + "navBottom.html"); |
||
| 36 | |||
| 37 | // Single whois |
||
| 38 | $('#swMainContainer').load(tab + "sw.html"); |
||
| 39 | |||
| 40 | // Bulk whois lookup tab/steps |
||
| 41 | $('#bwEntry').load(bw + "bwEntry.html"); |
||
| 42 | |||
| 43 | // Bulk whois file input |
||
| 44 | $('#bwFileinputloading').load(bw + "bwFileinputloading.html"); |
||
| 45 | $('#bwFileinputconfirm').load(bw + "bwFileinputconfirm.html"); |
||
| 46 | |||
| 47 | // Bulk whois wordlist input |
||
| 48 | $('#bwWordlistinput').load(bw + "bwWordlistinput.html"); |
||
| 49 | $('#bwWordlistloading').load(bw + "bwWordlistloading.html"); |
||
| 50 | $('#bwWordlistconfirm').load(bw + "bwWordlistconfirm.html"); |
||
| 51 | |||
| 52 | // Bulk whois processing |
||
| 53 | $('#bwProcessing').load(bw + "bwProcessing.html"); |
||
| 54 | $('#bwExport').load(bw + "bwExport.html"); |
||
| 55 | $('#bwExportloading').load(bw + "bwExportloading.html"); |
||
| 56 | |||
| 57 | // Bulk whois analyser containers |
||
| 58 | $('#bwaEntry').load(bwa + "bwaEntry.html"); |
||
| 59 | $('#bwaFileinputloading').load(bwa + "bwaFileinputloading.html"); |
||
| 60 | $('#bwaFileinputconfirm').load(bwa + "bwaFileinputconfirm.html"); |
||
| 61 | $('#bwaProcess').load(bwa + "bwaProcess.html"); |
||
| 62 | $('#bwaAnalyser').load(bwa + "bwaAnalyser.html"); |
||
| 63 | |||
| 64 | // Wordlist tools containers |
||
| 65 | $('#toEntry').load(to + "toEntry.html"); |
||
| 66 | |||
| 67 | // Options container |
||
| 68 | $('#opEntry').load(op + "opEntry.html"); |
||
| 69 | |||
| 70 | // Help container |
||
| 71 | $('#heMainContainer').load(tab + "he.html"); |
||
| 72 | })(); |
||
| 73 | |||
| 75 |